<template>
	<view class="content">
		<!-- 顶部 -->
		<view class="fixedbox" ref="fixedbox" :style="{'top': navBarHeight + 'rpx'}">
			<view class="bar-box">
				<view class="u-flex bar-top">
					<view class="icon-jia">
						<image class="icon-jia" src="../../static/icon/wechat_logo.png" mode=""></image>
					</view>
					<view class="input-box u-flex">
						<icon type="search" size="18" class="search-icon" />
						<div class="search-input">请输入</div>
					</view>
					<view class="icon-jia-box">
						<u-badge type="error" count="7" :offset="[-10,0]"></u-badge>
						<image class="icon-jia1" src="../../static/icon/notice.png" mode=""></image>
					</view>
				</view>
			</view>
			<view class="menu-box">
				<view class="menu-box-l">
					<view style="color:#014AF8">金融服务</view>
					<view>资产登记</view>
					<view>数据中心</view>
				</view>
				<view class="more-box">
					<u-icon name="more-dot-fill" size="40"></u-icon>
				</view>
			</view>
		</view>
		<view :style="{height:fixedboxHeight+'px'}"> </view>
		<view class="cards-box"></view>
		<view class="cards-box"></view>
		<view class="cards-box"></view>
		<view class="cards-box"></view>
		<view class="cards-box"></view>
		<view class="cards-box"></view>
		<view class="cards-box"></view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				title: '',
				navBarHeight: '',
				fixedboxHeight: 0
			}
		},
		onLoad() {

		},
		onShow() {
			this.getNavBarHeight()
			const _this = this
			let info = uni.createSelectorQuery().select(".fixedbox")
			info.boundingClientRect(function(data) {
				_this.fixedboxHeight = data.height + 40
			}).exec()

		},
		// 上拉加载
		onReachBottom() {

		},
		// 下拉刷新
		onPullDownRefresh() {

		},
		methods: {
			getNavBarHeight() {
				// 获取状态栏高度
				const {
					statusBarHeight
				} = uni.getSystemInfoSync();
				// 得到右上角菜单的位置尺寸 px
				const menuButtonObject = uni.getMenuButtonBoundingClientRect();
				const {
					top,
					height
				} = menuButtonObject;
				// 计算导航栏的高度 = 此高度基于右上角菜单在导航栏位置垂直居中计算得到
				const navBarHeight = height + (top - statusBarHeight) * 2;
				this.navBarHeight = navBarHeight + statusBarHeight
			}
		}
	}
</script>

<style lang="scss" scoped>
	.content {
		padding-bottom: 100rpx;
		.fixedbox {
			width: 100%;
			position: fixed;
			background-color: #FFFFFF;
			.bar-box {
				.bar-top {
					padding-bottom: 20rpx;
					padding-left: 30rpx;
					border-bottom: 1rpx solid #c8c8c8;
				}

				.icon-notice {
					width: 40rpx;
					height: 40rpx;
				}

				.icon-jia-box {
					position: relative;
					width: 66rpx;
					height: 66rpx;
					border: 1rpx solid #c8c8c8;
					border-radius: 50%;
					text-align: center;
					margin-top: 5rpx;
					margin-left: 10rpx;
				}

				.icon-jia1 {
					width: 44rpx;
					height: 44rpx;
					margin-top: 10rpx;
				}


				.icon-jia {
					width: 66rpx;
					height: 66rpx;
				}

				.search-box image {
					width: 32rpx;
					height: 32rpx;
				}

				.input-box {
					width: 360rpx;
					border: 1rpx solid #888888;
					height: 60rpx;
					opacity: 0.8;
					border-radius: 60rpx;
					padding-left: 16rpx;
					margin-left: 20rpx;
					margin-top: 10rpx;
				}

				.search-btn {
					margin-left: 30rpx;
					color: #FFFFFF;
					border: 1rpx solid #DCDFE6;
					width: 66rpx;
					height: 66rpx;
					text-align: center;
					border-radius: 50%;
					line-height: 76rpx;
				}

				.search-input {
					margin-left: 20rpx;
				}
			}
		}
	}

	.menu-box {
		position: relative;
		display: flex;
		height: 88rpx;
		margin-top: 40rpx;
		box-shadow: 0px 3px 3px 0px rgba(25, 137, 250, 23);

		.menu-box-l {
			display: flex;
			font-size: 36rpx;
			color: #9F9D9D;
			justify-content: space-around;
			width: 80%;
		}

		.more-box {
			position: absolute;
			display: flex;
			right: 28rpx;
			align-items: center;
			top: 10rpx;
		}
	}

	.cards-box {
		width: 700rpx;
		border-radius: 8rpx;
		height: 180rpx;
		background-color: #18B566;
		margin: 40rpx auto 0 auto;
	}
</style>
